package com.ruoyi.tjbb.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.tjbb.domain.SysTjbbBb;
import com.ruoyi.tjbb.service.ISysTjbbBbService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 车辆安全行驶报告Controller
 * 
 * @author ruoyi
 * @date 2023-09-26
 */
@RestController
@RequestMapping("/tjbb/qysjtj/claqxsbb")
public class SysTjbbBbController extends BaseController
{
    @Autowired
    private ISysTjbbBbService sysTjbbBbService;

    /**
     * 查询车辆安全行驶报告列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:claqxsbb:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysTjbbBb sysTjbbBb)
    {
        startPage();
        List<SysTjbbBb> list = sysTjbbBbService.selectSysTjbbBbList(sysTjbbBb);
        return getDataTable(list);
    }

    /**
     * 导出车辆安全行驶报告列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:claqxsbb:export')")
    @Log(title = "车辆安全行驶报告", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysTjbbBb sysTjbbBb)
    {
        List<SysTjbbBb> list = sysTjbbBbService.selectSysTjbbBbList(sysTjbbBb);
        ExcelUtil<SysTjbbBb> util = new ExcelUtil<SysTjbbBb>(SysTjbbBb.class);
        util.exportExcel(response, list, "车辆安全行驶报告数据");
    }

    /**
     * 获取车辆安全行驶报告详细信息
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:claqxsbb:query')")
    @GetMapping(value = "/{tatol}")
    public AjaxResult getInfo(@PathVariable("tatol") String tatol)
    {
        return success(sysTjbbBbService.selectSysTjbbBbByTatol(tatol));
    }

    /**
     * 新增车辆安全行驶报告
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:claqxsbb:add')")
    @Log(title = "车辆安全行驶报告", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysTjbbBb sysTjbbBb)
    {
        return toAjax(sysTjbbBbService.insertSysTjbbBb(sysTjbbBb));
    }

    /**
     * 修改车辆安全行驶报告
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:claqxsbb:edit')")
    @Log(title = "车辆安全行驶报告", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysTjbbBb sysTjbbBb)
    {
        return toAjax(sysTjbbBbService.updateSysTjbbBb(sysTjbbBb));
    }

    /**
     * 删除车辆安全行驶报告
     */
    @PreAuthorize("@ss.hasPermi('tjbb/qysjtj:claqxsbb:remove')")
    @Log(title = "车辆安全行驶报告", businessType = BusinessType.DELETE)
	@DeleteMapping("/{tatols}")
    public AjaxResult remove(@PathVariable String[] tatols)
    {
        return toAjax(sysTjbbBbService.deleteSysTjbbBbByTatols(tatols));
    }
}
